﻿// /*
//  * @Author: wanyiming
//  * @Date:2024-07-15-21:28
//  * @Description:
//  */

using Code.Core.StateMachine;
using UnityEngine;

namespace Code.GameLogic.XianJian.XianJianBehavior.MainBehavior
{
    public abstract class AbsActBehavior:State<XianJianFms>
    {
        private float _lastAttackTime;
        private double _asp;
        
        
        public void Attack(ActFunction actFunction,GameObject gameObject,string actCode)
        {
            if (Time.time - _lastAttackTime >= GetAsp())
            {
                // 执行攻击逻辑
                _lastAttackTime = Time.time; // 更新上次攻击时间
                actFunction(gameObject,actCode);
            }
        }

        protected abstract double GetAsp();
     
        
        public delegate void ActFunction(GameObject gameObject,string actCode);
    }
}